package com.atguigu.juc;

import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author tongatong
 * @name MainTest
 * @description
 * @date 2021/8/31
 * @time 10:47
 */
public class MainTest {
    private static int k;

    public static void main(String[] args) {

/*        //i++不是一个原子性操作
        for (int i = 1; i <= 15; i++) {
            new Thread(() -> {
//                System.out.println(finalI +1);
                k++;
                System.out.println(k);
            }, String.valueOf(i)).start();
        }*/

/*        CountDownLatch countDownLatch = new CountDownLatch(15);

        for (int i = 1; i <= 15; i++) {
            new Thread(() -> {
                k++;
                System.out.println(k);
                countDownLatch.countDown();

            }, String.valueOf(i)).start();
        }

        try {
            countDownLatch.await();
            System.out.println("完成");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/



    }
}
